package com.ruoyi.supplier.controller;

import java.util.List;
import java.io.IOException;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.supplier.domain.SupShopLogo;
import com.ruoyi.supplier.service.ISupShopLogoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * logo店招信息Controller
 * 
 * @author zjf
 * @date 2025-11-05
 */
@RestController
@RequestMapping("/logo")
public class SupShopLogoController extends BaseController
{
    @Autowired
    private ISupShopLogoService supShopLogoService;

    /**
     * 查询logo店招信息列表
     */
    @RequiresPermissions("system:logo:list")
    @GetMapping("/list")
    public TableDataInfo list(SupShopLogo supShopLogo)
    {
        startPage();
        List<SupShopLogo> list = supShopLogoService.selectSupShopLogoList(supShopLogo);
        return getDataTable(list);
    }

    /**
     * 导出logo店招信息列表
     */
    @RequiresPermissions("system:logo:export")
    @Log(title = "logo店招信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SupShopLogo supShopLogo)
    {
        List<SupShopLogo> list = supShopLogoService.selectSupShopLogoList(supShopLogo);
        ExcelUtil<SupShopLogo> util = new ExcelUtil<SupShopLogo>(SupShopLogo.class);
        util.exportExcel(response, list, "logo店招信息数据");
    }

    /**
     * 获取logo店招信息详细信息
     */
    @RequiresPermissions("system:logo:query")
    @GetMapping(value = "/{logoId}")
    public AjaxResult getInfo(@PathVariable("logoId") Long logoId)
    {
        return success(supShopLogoService.selectSupShopLogoByLogoId(logoId));
    }

    /**
     * 新增logo店招信息
     */
    @RequiresPermissions("system:logo:add")
    @Log(title = "logo店招信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SupShopLogo supShopLogo)
    {
        return toAjax(supShopLogoService.insertSupShopLogo(supShopLogo));
    }

    /**
     * 修改logo店招信息
     */
    @RequiresPermissions("system:logo:edit")
    @Log(title = "logo店招信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SupShopLogo supShopLogo)
    {
        return toAjax(supShopLogoService.updateSupShopLogo(supShopLogo));
    }

    /**
     * 删除logo店招信息
     */
    @RequiresPermissions("system:logo:remove")
    @Log(title = "logo店招信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logoIds}")
    public AjaxResult remove(@PathVariable Long[] logoIds)
    {
        return toAjax(supShopLogoService.deleteSupShopLogoByLogoIds(logoIds));
    }
}
